<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 12-5-15
  Time: 下午11:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page pageEncoding="UTF-8" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <%
        String  par_ddId=(String)request.getParameter("ddId");
        String  modId=(String)request.getParameter("modId")==null? "":request.getParameter("modId");

    %>
    <title></title>
    <style type="text/css" >
        html, body {
            font: normal 12px verdana;
            margin: 0;
            padding: 5;
            border: 0 none;
            overflow: hidden;
            height: 100%;
        }
        td{
            font: normal 12px verdana;
            margin: 0;
            padding: 0;
            border: 0 none;
            overflow: hidden;
            height: 100%;
        }
        p {
            margin: 5px;
        }
    </style>
    <script type="text/javascript">
     	var name = '';
		try{
        	name=parent.grid.getStore().getAt(0).data['name']
        }catch(e){}
        parent.save_fun = function(){
             document.forms[0].submit();
        }

        function setValue(){
               var dd_id="<%=par_ddId%>"
               var modFlag="<%=modId%>"
               // alert(modFlag.length)
               // alert(trim(modFlag.length))

                if(modFlag!=''){

                    var modId= parseInt(modFlag)
                    document.forms[0]. code.value=parent.grid.getStore().getById(modId).data['code']
                    document.forms[0]. name.value=parent.grid.getStore().getById(modId).data['name']
                    document.forms[0].dddId.value=parent.grid.getStore().getById(modId).data['dddId']
                    document.forms[0].describe.value=parent.grid.getStore().getById(modId).data['describe']
                    document.forms[0].zmark.value=parent.grid.getStore().getById(modId).data['zmark']
                    document .forms[0].ddId.value=parseInt(dd_id)
                    document .forms[0].optFlag.value='mod'
                }
                // 增加
              else {

                    document .forms[0].ddId.value=parseInt(dd_id)
                    document.forms[0].dddId.value=0

                    document .forms[0].optFlag.value='add'
                }
        }
    </script>


</head>

<body onload="setValue()">

<s:form namespace="/dataDictionary" action="updateDataForJsp" method="post" theme="simple" >
       <table align="center" style="">
           <br>
           <tr>
               <s:hidden name="dddId"></s:hidden>
               <s:hidden name="ddId" ></s:hidden>
               <s:hidden name="optFlag"  value="add"></s:hidden>
               <td>
                    编码：
                   <s:textfield name="code" size="12" ></s:textfield>
               </td>
           </tr>
           <tr>
               <td>
                   名称：
                   <s:textfield name="name" size="30" ></s:textfield>
               </td>
           </tr>
           <tr>
               <td>
                   说明：
                   <s:textfield name="describe" size="50" ></s:textfield>
               </td>
           </tr>
           <tr>
               <td>
                   标记：
                   <s:textfield name="zmark" size="12" ></s:textfield>
               </td>
           </tr>
       </table>
</s:form>
</body>
</html>